﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace DataBase
{
    public class FreeSqlService
    {
        public IFreeSql From { get; set; }
        public IFreeSql Main { get; set; }

        public IFreeSql OtherFrom { get; set; }
        public FreeSqlService()
        {
            From = new FreeSql.FreeSqlBuilder()
              .UseConnectionString(FreeSql.DataType.SqlServer, @"data source=192.168.100.13;initial catalog=FrontEnd4.0From;pooling=true;max pool size=2;User Id=pcmsadmin;Password=111111_a")
              .Build();
            Main = new FreeSql.FreeSqlBuilder()
              .UseConnectionString(FreeSql.DataType.SqlServer, @"data source=192.168.100.13;initial catalog=FrontEnd4.0Main;pooling=true;max pool size=2;User Id=pcmsadmin;Password=111111_a")
              .Build();
        }


        public void InitOtherFrom(string ip,string dbName)
        {
            OtherFrom = new FreeSql.FreeSqlBuilder()
              .UseConnectionString(FreeSql.DataType.SqlServer, $"data source={ip};initial catalog={dbName};pooling=true;max pool size=2;User Id=pcmsadmin;Password=111111_a")
              .Build();
        }
    }
}
